import numpy as np
import cv2
import glob
import os
path = "/home/jiayu/Desktop/Jimmy/1219(分六组)/600-1219_all_nerve/label_rgb"
img_path = "/home/jiayu/Desktop/Jimmy/1219(分六组)/600-1219_all_nerve/gt/"
for jpg_path in glob.glob(os.path.join(path, '*.png')):
    img_name = os.path.basename(jpg_path)
    img = cv2.imread(jpg_path,-1)
    img_rgb = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
    img_paths = img_path+img_name
    cv2.imwrite(img_paths, img_rgb)


# import cv2
# import glob
# import os
# path = " ../*.png"
#
# for img_path in glob.glob(path):
#     img_name = os.path.basename(img_path)
#     img = cv2.imread(img_path, -1)
#     img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
#     new_path = img_path + img_name
#     cv2.imwrite(new_path, img_rgb)